package cn.sc.summer.rabbitmq.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 枚举类型：mq消息失败类型枚举类
 *
 * @author a-xin
 * @date 2023/10/23 13:18
 */
@Getter
@AllArgsConstructor
@SuppressWarnings("all")
public enum RabbitErrorMessageTypeEnum {

    USER_LOGIN_ERROR("USER_LOGIN_ERROR", "用户登录失败消息报告发送邮件通知消息失败！"),
    LOG_WRITE("LOG_WRITE", "接口日志信息落库异常！"),
    SMS_WRITE("SMS_WRITE", "短信发送日志落库异常！"),
    SMS_SEND_ERROR("SMS_SEND_ERROR", "短信发送超上限发送邮件通知消息失败！"),
    SERVER_SYSTEM_INFO_WRITE_ERROR("SERVER_SYSTEM_INFO_WRITE_ERROR", "服务实例服务器资源入库失败！"),
    SLOW_SQL_WRITE_ERROR("SLOW_SQL_WRITE_ERROR", "慢sql日志落库异常！"),
    GATEWAY_LOG_WRITE_ERROR("GATEWAY_LOG_WRITE_ERROR", "网关请求日志落库异常！"),
    ;

    private String type;
    private String info;

    public static RabbitErrorMessageTypeEnum getByType(Integer type) {
        if (null == type) {
            return null;
        }
        for (RabbitErrorMessageTypeEnum enums : RabbitErrorMessageTypeEnum.values()) {
            if (enums.type.equals(type)) {
                return enums;
            }
        }
        return null;
    }

}
